package com.steptime.jvm;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class MemoryDemo {
    static List<String> stringList = new ArrayList<>();
    static List<Class> classList = new ArrayList<>();

    /**
     * jvmP:  -Xmx32M -Xms32M
     */
    @Test
    public void testHeap() {
        while (true) {
            stringList.add("OutOfMemory");
        }
    }
    /**
     * jvmP:   -XX:MetaspaceSize=32M -XX:MaxMetaspaceSize=32M
     */
    @Test
    public void testNoHeap() {
        while (true) {
            classList.addAll(Metaspace.createClasses());
        }
    }
}
